export default {
  data () {
    return {
      schoolList: []
    }
  },
  created () {
    this.getSchoolList()
  },
  methods: {
    getSchoolList () {
      let that = this
      let _areaName = sessionStorage.getItem('area')
      that.$http.getArea().then(res => {
        if (res.code === 20000) {
          if (_areaName) {
            that.schoolList = res.data.child.filter(item => {
              return _areaName === item.areaName
            })
          } else {
            that.schoolList = res.data.child
          }
        } else {
          that.$message.error(res.msg)
        }
      })
    }
  }
}
